#!/usr/bin/env python
# -*- coding:utf8 -*-

"""
@version: 
@author: lh
@license: Apache Licence 
@contact: liuhuan0672@gmail.com
@site: 
@software: PyCharm
@file: 0012.py
@time: 2016/1/21 8:56
"""


def filter_words(words):
    file_obj = open('./static/filter_words.txt', 'r', encoding='utf-8')
    filtered_words = []
    for line in file_obj:
        filtered_words.append(line.strip('\n'))
    file_obj.close()

    for filtered_word in filtered_words:
        if filtered_word in words:
            words = words.replace(filtered_word, '*' * len(filtered_word))
    return words


if __name__ == '__main__':
    while True:
        inputs = input('Input some words:')
        out = filter_words(inputs)
        print(out)
